package com.kb.common;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Map;

/**
 * @author 国创工软
 */

@Data
@Document(indexName = "#{@environment.getProperty('es.index.component')}")
public class ComponentIndex implements Serializable {

    private static final long serialVersionUID = 7118858963867439527L;

    @Id
    @Field(type = FieldType.Keyword, value = "id")
    private String id;

    @Field(type = FieldType.Text, value = "part_number", analyzer = "my_ngram_analyzer")
    private String partNumber;

    @Field(type = FieldType.Keyword, value = "image_ids", index = false)
    private String imageIds;

    @Field(type = FieldType.Long, value = "original_id")
    private Long originalId;

    @Field(type = FieldType.Text, value = "product_params")
    private String productParams;

    @Field(type = FieldType.Keyword, value = "datasheet_name")
    private String datasheetName;

    @Field(type = FieldType.Long, value = "datasheet_file_id", index = false)
    private Long datasheetFileId;

    @Field(type = FieldType.Long, value = "symbol_id", index = false)
    private Long symbolId;

    @Field(type = FieldType.Long, value = "footprint_id", index = false)
    private Long footprintId;

    @Field(type = FieldType.Long, value = "model3d_id", index = false)
    private Long model3dId;

    @Field(type = FieldType.Keyword, value = "roHs", index = false)
    private Boolean roHs;

    @Field(type = FieldType.Keyword, value = "reach", index = false)
    private Boolean reach;

    @Field(type = FieldType.Keyword, value = "hf", index = false)
    private Boolean hf;

    @Field(type = FieldType.Keyword, value = "org_id")
    private String orgId;

    @Field(type = FieldType.Text, value = "org_name", analyzer = "my_ngram_analyzer")
    private String orgName;

    @Field(type = FieldType.Text, value = "category_name", analyzer = "my_ngram_analyzer")
    private String categoryName;

    @Field(type = FieldType.Text, value = "description")
    private String description;

    @Field(type = FieldType.Keyword, value = "plat_cat_id")
    private String platCatId;

    @Field(type = FieldType.Keyword, value = "org_cat_id")
    private String orgCatId;

    @Field(type = FieldType.Object, value = "similarity_agg_params")
    private Map<String, Object> similarityAndAggParams;

    @Field(type = FieldType.Text, value = "search_params", analyzer = "my_ngram_analyzer")
    private String searchParams;

}
